<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Formatters</title>
<script src="../locale/__ns__.js"></script>
<script src="../locale/Calendar.js"></script>
<script src="__ns__.js"></script>
<script src="NumberFormatter.js"></script>
<script src="DateFormatter.js"></script>
<script>
  if (window.console) {
    var formatter = new formatters.NumberFormatter;
    console.log([1000, formatter.format(1000)]);
    console.log([10000, formatter.format(10000)]);
    console.log([100000, formatter.format(100000)]);
    console.log([1000000, formatter.format(1000000)]);

    formatter = new formatters.NumberFormatter({'fraction': 2});
    console.log([1000.123, formatter.format(1000.123)]);
    console.log([10000.123, formatter.format(10000.123)]);
    console.log([100000.123, formatter.format(100000.123)]);
    console.log([1000000.123, formatter.format(1000000.123)]);

    formatter = new formatters.NumberFormatter({'prefix': '$'});
    console.log([1000.123, formatter.format(1000.123)]);
    console.log([10000.123, formatter.format(10000.123)]);
    console.log([100000.123, formatter.format(100000.123)]);
    console.log([1000000.123, formatter.format(1000000.123)]);

    formatter = new formatters.NumberFormatter({'suffix': '%'});
    console.log([1000.123, formatter.format(1000.123)]);
    console.log([10000.123, formatter.format(10000.123)]);
    console.log([100000.123, formatter.format(100000.123)]);
    console.log([1000000.123, formatter.format(1000000.123456)]);

    formatter = new formatters.DateFormatter;
    console.log(['dd MMMM YYYY', formatter.format(new Date(2003, 0, 1), 'dd MMMM YYYY')]);
    console.log(['dd MMM YYYY', formatter.format(new Date(2003, 1, 10), 'dd MMM YYYY')]);
    console.log(['YYYY-MM-dd', formatter.format(new Date(2003, 2, 20), 'YYYY-MM-dd')]);
    console.log(['YYYY-MM-dd hh:mm', formatter.format(new Date, 'YYYY-MM-dd hh:mm')]);
    console.log(['YYYY-MM-dd hh:mm:ss', formatter.format(new Date, 'YYYY-MM-dd hh:mm:ss')]);

    console.log(['2013-03-31', formatter.parse('2013-03-31', 'YYYY-MM-dd')]);
    console.log(['2013-03-31 01:02:03', formatter.parse('2013-03-31 01:02:03', 'YYYY-MM-dd hh:mm:ss')]);
    console.log(['31 Jan, 2013', formatter.parse('31 Jan, 2013', 'dd MMM, YYYY')]);
    console.log(['30 Jun, 2013', formatters.DateFormatter.parse('30 Jun, 2013', 'dd MMM, YYYY')]);

  }
</script>
</head>
<body>Open javascript console to see formatters results.</body>
</html>